﻿using System;
using Microsoft.Xna.Framework;
using CellarDoor.Gui.Elements;

namespace CellarDoor.Gui.Animation
{
    public class AnimateOpacity : AnimateComponent
    {
        /// <summary>
        /// The start color
        /// </summary>
        public float StartOpacity { get; set; }

        /// <summary>
        /// The end color
        /// </summary>
        public float EndOpacity { get; set; }

        public AnimateOpacity(UiElement element)
            : base(element)
        {
        }

        protected override void Animate()
        {
            Target.Opacity = StartOpacity + (EndOpacity - StartOpacity) * EasedProgress;
        }
    }
}
